#!/usr/bin/env python3
# -*- coding: utf-8 -*-

from typing import Dict

HEADERS: Dict[str, str] = {
    "User-Agent": (
        "Mozilla/5.0 (Windows NT 10.0; Win64; x64) "
        "AppleWebKit/537.36 (KHTML, like Gecko) "
        "Chrome/139.0.0.0 Safari/537.36"
    ),
    "Referer": "https://www.bilibili.com/v/popular/rank/animal",
    "Accept": "application/json, text/plain, */*",
}

URLS: Dict[str, str] = {
    "全站": "https://api.bilibili.com/x/web-interface/ranking/v2?rid=0&type=all",
    "音乐": "https://api.bilibili.com/x/web-interface/ranking/v2?rid=1003&type=all",
    "动画": "https://api.bilibili.com/x/web-interface/ranking/v2?rid=1005&type=all",
    "游戏": "https://api.bilibili.com/x/web-interface/ranking/v2?rid=1008&type=all",
    "舞蹈": "https://api.bilibili.com/x/web-interface/ranking/v2?rid=1004&type=all",
    "美食": "https://api.bilibili.com/x/web-interface/ranking/v2?rid=1020&type=all",
    "鬼畜": "https://api.bilibili.com/x/web-interface/ranking/v2?rid=1007&type=all",
    "影视": "https://api.bilibili.com/x/web-interface/ranking/v2?rid=1001&type=all",
    "娱乐": "https://api.bilibili.com/x/web-interface/ranking/v2?rid=1002&type=all",
    "知识": "https://api.bilibili.com/x/web-interface/ranking/v2?rid=1010&type=all",
    "科技数码": "https://api.bilibili.com/x/web-interface/ranking/v2?rid=1012&type=all",
    "汽车": "https://api.bilibili.com/x/web-interface/ranking/v2?rid=1013&type=all",
    "美妆": "https://api.bilibili.com/x/web-interface/ranking/v2?rid=1014&type=all",
    "体育": "https://api.bilibili.com/x/web-interface/ranking/v2?rid=1018&type=all",
    "动物": "https://api.bilibili.com/x/web-interface/ranking/v2?rid=1024&type=all",
}

# 视频下载相关配置
DOWNLOAD_CONFIG = {
    # 下载工具配置 (推荐使用 yt-dlp)
    "downloader": "yt-dlp",
    
    # 视频质量配置
    "video_quality": "best[height<=1080]",  # 最高1080p
    
    # 音频质量配置
    "audio_quality": "bestaudio",
    
    # 输出格式
    "output_format": "mp4",
    
    # 下载超时时间（秒）
    "timeout": 300,
    
    # 重试次数
    "retry_count": 3,
    
    # 下载速度限制 (可选，如 "1M" 表示1MB/s)
    "rate_limit": None,
    
    # 是否下载字幕
    "download_subtitles": True,
    
    # 字幕语言
    "subtitle_langs": ["zh-CN", "zh-TW"],
    
    # 是否保留临时文件
    "keep_temp_files": False,
}

# 文件路径配置
PATH_CONFIG = {
    # 项目根目录（绝对路径）
    "project_root": "/data/flip-cast",
    
    # 数据目录（绝对路径）
    "data_dir": "/data/flip-cast/data",
    
    # 视频输出目录（绝对路径）
    "video_output_dir": "/data/flip-cast/data/video",
    
    # CSV文件目录模式
    "csv_dir_pattern": "/data/flip-cast/data/*/",
    
    # 日志目录（绝对路径）
    "log_dir": "/data/flip-cast/logs",
}

# 下载任务配置
TASK_CONFIG = {
    # 并发下载数量
    "concurrent_downloads": 2,
    
    # 是否跳过已存在的文件
    "skip_existing": True,
    
    # 文件命名格式 (支持的变量: {bvid}, {title}, {author}, {index})
    "filename_format": "{bvid}_{title}",
    
    # 最大文件名长度
    "max_filename_length": 100,
    
    # 是否清理文件名中的特殊字符
    "clean_filename": True,
}
